package com.hr.String不可变性;

/**
 * @program: leetcode
 * @description:
 * @author: HuRan QQ1345122890
 * @create: 2021-03-02 19:48
 */
public class StringTest {
    public static void main(String[] args) {
        int i=1;
        Object obj=new Object();
        StringTest t=new StringTest();
        t.foo(obj);
    }

    private void foo(Object obj) {
        String string = obj.toString(); // string 变量在堆中创建
        System.out.println(string);
    }
}